/*
 ============================================================================
 Name		: FaceAuthetificator.h
 Author	  : Lenka Litvova
 Version	 : 1.0
 Copyright   : Your copyright notice
 Description : CFaceAuthetificator declaration
 ============================================================================
 */

#ifndef FACEAUTHETIFICATOR_H
#define FACEAUTHETIFICATOR_H

#include <e32base.h>	// For CActive, link against: euser.lib
#include <e32std.h>		// For RTimer, link against: euser.lib
#include "FaceGraph.h"
#include "AuthetificationObserver.h"

class CFaceAuthetificator : public CActive
	{
public:
	// Cancel and destroy
	~CFaceAuthetificator();

	// Two-phased constructor.
	static CFaceAuthetificator* NewL(CFaceGraph* aActualFace, MAuthetificationObserver* aObserver);

	// Two-phased constructor.
	static CFaceAuthetificator* NewLC(CFaceGraph* aActualFace, MAuthetificationObserver* aObserver);

public:
	// New functions
	// Function for making the initial request
	void StartL();
	
	TBufC<KMaxFileName> GetAuthentificatedUser();

private:
	// C++ constructor
	CFaceAuthetificator(CFaceGraph* aActualFace, MAuthetificationObserver* aObserver);

	// Second-phase constructor
	void ConstructL();

private:
	// From CActive
	// Handle completion
	void RunL();

	// How to cancel me
	void DoCancel();

	// Override to handle leaves from RunL(). Default implementation causes
	// the active scheduler to panic.
	TInt RunError(TInt aError);
	
	void GetGraphListL();
	
	TBool AuthetificateL(TInt aGraph);

private:
	TBool iCancel;
	
	TInt iCounter;
	CFaceGraph* iActualFace;
	
	CDir *iFiles;
	
	MAuthetificationObserver *iObserver;

	};

#endif // FACEAUTHETIFICATOR_H
